import 'package:flutter/material.dart'; 

import '../pages/tab/index.dart';
import '../pages/socket/index.dart';
import '../pages/international/index.dart';

/// 路由配置
final routes = {
  '/': (context) => Tabs(),
  '/socket': (context) => SocketPage(),
  '/international': (context) => InternationalPage(),
};

/// 固定写法 
var onGenerateRoute = (RouteSettings settings) { 
  /// 统一处理 
  final String name = settings.name; 
  final Function pageContentBuilder = routes[name]; 
  if (pageContentBuilder != null) { 
    if (settings.arguments != null) { 
      final Route route = MaterialPageRoute(builder: (context) => pageContentBuilder(context, arguments: settings.arguments)); 
      return route; 
    }else{
      final Route route = MaterialPageRoute( 
        builder: (context) => pageContentBuilder(context)); return route; 
    }
  }
};